<?php

/**
 * Description of Settings
 *
 * @author Костя
 */
class SettingsAdmin {

    function __construct() {
        $this->_db = Db::getInstance();
    }

    function addAdmin($login, $password) {
        $select = $this->_db->qr('select * from `admins` WHERE nickname LIKE "' . $login . '"');
        if (count($select) > 0) {
            return 'Такое имя уже занято!';
        } else {
            $query = $this->_db->q('INSERT INTO `admins` (nickname,password) VALUES ("' . $login . '","' . md5($password) . '");');
            return ($query) ? 'yes' : 'no';
        }
    }

    function getAllSetting() {
        $entities = $this->_db->qr("select * from `options`", 1);
        return $entities;
    }

    function addNewSetting() {
        
    }

    function getSpecificSetting() {
        
    }

    function getAllAdmins() {
        return $this->_db->qr("select `id`,`nickname` from `admins`", 1);
    }

    function GS($name) {
        return $this->_db->qr("select * from `options`", 1);
    }

}

?>
